XREAL Markers
Introductionβ
Introducing XREAL Markers, a novel set of 'interactive' image tracking cards designed to facilitate virtual and real-world interaction. By manipulating the magnetic sliders on the cards, users can engage in dynamic gameplay experiences. The cards are available in three distinct colors: green for bidirectional functionality, blue for tridirectional, and orange for six-directional capabilities. Developers are encouraged to leverage the cards' interactive features to innovate and enhance both new and existing applications. Additionally, we invite you to explore the sample application 'Spatial Life,' thoughtfully crafted by the XREAL design team.
Requirementβ
To ensure optimal performance and compatibility when using the Spatial Life application, the following hardware and software specifications must be met:
- Android phones listed in Device Compatibility or Beam Pro
- XREAL Air 2 Ultra
- Nebula 3.8.0
For developers interested in creating applications akin to Spatial Life, with feature coaster image tracking, additional resource is required:
NRSDKForUnity Experimental
2024.09.26
Regular updates released with the normal version.
2024.06.19
Regular updates released with the normal version.
2024.04.18
Fixed: The problem of not being recognized after switching back from the background.
2024.03.29
Developers who donβt have Marker cards can download and print this PDF file for use.
Usage Instructions:
- Please print the Marker images on matte A4 paper in color to ensure accurate output size.
- When printing, do not enlarge the image; print at 100% scale.
- Cut out the Marker along the black border and attach it to a rigid cardboard.
- Within the cameraβs recognition range, only one card of the same color should appear.
Developer Guideβ
Learn how to use the Coasters Image Tracking feature in your own apps.
- Create a new project in Unity.
Need help setting up? Try Getting Started with NRSDK first
-
Click NRSDK -> CoastersTrackingModule -> Install
Note that the coasters image tracking is not compatible with the original image tracking. If you want to use the old version SDK, click uninstall.
-
Open scene
CoastersimageTracking
-
Modify your application logic as needed. The editor includes a simulator for image tracking, demonstrated in the screenshot below. This simulator provides 11 buttons, each corresponding to one of the 11 images. By clicking these buttons, you can simulate the tracking effect for the respective image.
-
The Marker feature uses a trained data sample. The sample resource address is shown in the figure below. It needs to be specified in the SessionConfig resource.
-
Set the ImageTrackingMode to enable.
-
Before building an APK, please add the following lines inside the
<application>
element of yourAndroidManifest.xml
<uses-library android:name="libOpenCL.so" android:required="false"/>
<uses-library android:name="libcdsprpc.so" android:required="false"/>
Usageβ
Get the current tracked Image list.β
NRFrame.GetTrackables<NRTrackableImage>(m_TempTrackingImages, NRTrackableQueryFilter.All);
Get the tracking status of Imageβ
In Marker, the
GetTrackingState
method will only return two states: Tracking and Paused.
NRTrackableImage.GetTrackingState()
/// <summary> Device Tracking State. </summary>
public enum TrackingState
{
/// <summary>
/// TRACKING means the object is being tracked and its state is valid.
/// </summary>
Tracking = 0,
/// <summary>
/// PAUSED indicates that NRSDK has paused tracking,
/// and the related data is not accurate.
/// </summary>
Paused = 1,
/// <summary>
/// STOPPED means that NRSDK has stopped tracking, and will never resume tracking.
/// </summary>
Stopped = 2
}
Get the ID of the Imageβ
In Marker, the value range of ID is [0,10], corresponding to different states of Marker cards.
NRTrackableImage.GetCoastersDataBaseIndex()
Get image pose and size informationβ
// The length in the X direction of the image
NRTrackableImage.ExtentX
// The length in the Z direction of the image
NRTrackableImage.ExtentZ
// Get the pose of the center of the image
NRTrackableImage.GetCenterPose
Enable and disable ImageTracking functionalityβ
/// <summary> Enables the image tracking. </summary>
public void EnableImageTracking()
{
var config = NRSessionManager.Instance.NRSessionBehaviour.SessionConfig;
config.ImageTrackingMode = TrackableImageFindingMode.ENABLE;
NRSessionManager.Instance.SetConfiguration(config);
}
/// <summary> Disables the image tracking. </summary>
public void DisableImageTracking()
{
var config = NRSessionManager.Instance.NRSessionBehaviour.SessionConfig;
config.ImageTrackingMode = TrackableImageFindingMode.DISABLE;
NRSessionManager.Instance.SetConfiguration(config);
}